list1 = [[0, 2], [5, 10], [13, 23], [24, 25]]
list2 = [[1, 5], [8, 12], [15, 24], [25, 26]]
result = []

while list1 and list2:
    if list1[0][0] > list2[0][1]:
        result.append(list2[0])
        list2.pop(0)
    elif list1[0][1] < list2[0][0]:
        result.append(list1[0])
        list1.pop(0)
    else:
        start = max(list1[0][0], list2[0][0])
        end = min(list1[0][1], list2[0][1])
        result.append([start, end])
        if list1[0][1] < list2[0][1]:
            list1.pop(0)
        else:
            list2.pop(0)

print(result)